/**
* 作者: clz
* 日期: 2025-04-10 21:19:43
* 备注: 联盟建筑成员建设记录
*/
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.protocol.Common;
import com.motu.monstercity.protocol.CsGameUnion;
import com.motu.monstercity.server.game.logic.UnionManager;
import com.motu.vertx.module.utility.toolset.TimeUtils;
import io.vertx.core.json.JsonArray;

public class UnionBuildUserRecord extends UnionBuildUserRecordModel {
	public UnionBuildUserRecord() {
		super();
	}
	public UnionBuildUserRecord(long unionId,int buildId,long userId,int consume) {
		putUnionBuildId(unionId + "-" + buildId);
		putUserId(userId);
		putDayBuildCost(consume);
		putBuildCost(consume);
	}

	public void reset() {
		long curTime = TimeUtils.getCurTime();
		if (!TimeUtils.isToday(resetTime)) {
			putResetTime(curTime);
			putDayBuildCost(0);
			update();
		}
	}
	public Common.PBUnionUserRecord.Builder takeBuilder() {
		return UnionManager.takePBUnionUserRecordBuilder(getUserId(),getDayBuildCost(),getBuildCost(),2);
	}
}
